<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../common/taglibs.jsp"%>
<html>
<head>
	<base href="<%=basePath%>">
	<link rel="stylesheet" href="css/screen.css" type="text/css"></link>
	<style type="text/css"></style>
	<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
	<script language="javascript">
$(function() {
	 $.ajax({
				 type: 'get',
				 url: "plan/PlanRetailerAction.do",
				 data: {method: "getRetailerTypeList"},
				 success: function(CreturnDate){ 
				 var returnDate=eval('(' + CreturnDate + ')');
				 var i;
				 for(i=0;i<returnDate.length;i++){
					 $("#retailType").append("<option value='"+returnDate[i].retailerTypeId+"'>"+returnDate[i].retailerTypeName+"</option>")
				 }
 				}
 			}); 
   $("#abSearch").click(
   	  function() {
       var retailNo=$("#retailNo").val();
       var retailName=$("#retailName").val();
       var retailType=$("#retailType").val();
       var city=$("#city").val();
       if(retailNo==null && retailName==null && retailType==null &&  city==null ){
           alert("请输入条件");
       }else{
        searchForm.submit();
        //todo
       }
       
   });
    $("#newRetailer").click(
    	  function() {
    	  window.location.href="redetailer/redetailerAction.do?method=showRetailer"
    });
    $("#new4sRetailer").click(
    	  function() {
    	  window.location.href="redetailer/redetailerAction.do?method=showRetailer4s"
    });
});
function ejiaA1(o,a,b,c,d){
var t=document.getElementById(o).getElementsByTagName("tr");
for(var i=1;i<t.length;i++){
	t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
  }
}
$(function() {
	$("#confirm").click(function() {
	var arrayId = new Array();
	var arrayName = new Array();
	var arrayLoop = new Array();
		$('#ejiaA1 >tbody >tr[pId!="0"]').each(
		function() {
		       arrayId.push($.trim(this.getElementsByTagName("td")[0].innerHTML));	
		       arrayName.push($.trim(this.getElementsByTagName("td")[1].innerHTML));		
		       arrayLoop.push($.trim(this.getElementsByTagName("td")[2].innerHTML));		
		});
		var returnValue={id:arrayId,name:arrayName,loop:arrayLoop};
		window.returnValue=returnValue;
		window.close();
	});
});
</script>
</head>
<body>
	<div style="">
		<h3>
			零售商选择
		</h3>
		<table width="100%">
			<tr>
				<td width="5">
					<input type="button" value="新增零售店" id="newRetailer">
				</td>
				<td width="5">
					<input type="button" value="新增4S店" id="new4sRetailer">
				</td>
			</tr>
		</table>
		<form id="searchForm"
			action="redetailer/retailerListAction.do?method=getRetailerList"
			method="post">
			<table class="" width="100%">
				<tbody>
					<tr>
						<td>
							<table cellpadding="1" cellspacing="1" border="1" >
								<tr>
									<td width="100px">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 50px;">
														<label>
															店编号
														</label>
													</td>
													<td>
														<input id="retailNo"  name="retailNo" type="text" value="" size="5"
															name="retailNo">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="100px">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 50px;">
														<label>
															店名
														</label>
													</td>
													<td>
														<input id="retailName" name="retailName" type="text"
															value="" size="5">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="100px">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 80px;">
														<label>
															店类别
														</label>
													</td>
													<td>
														<select id="retailType" name="retailType">
															<option value="">请选择</option>
														</select>
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td width="100px">
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tbody>
												<tr valign="top">
													<td class="label" style="width: 50px;">
														<label>
															城市
														</label>
													</td>
													<td>
														<input id="city" type="text" value="" size="5" name="city">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
									<td>
										<input id="abSearch" type="submit" value="搜索">
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
		<table id="ejiaA1" class="simple" width="100%">
			<thead>
				<tr>
					<td width="9%">
						店编号
					</td>
					<td width="9%">
						店名
					</td>
					<td width="9%">
						零售店类别
					</td>
					<td width="9%">
						城市
					</td>
					<td width="9%">
						路径
					</td>
					<td width="9%">
						地址
					</td>
					<td width="9%">
						是否有新计划
					</td>
					<td width="9%">
						查看拜访
					</td>
					<td width="9%">
						客户信息
					</td>
					<td width="9%">
						签约
					</td>
					<td width="9%">
						编辑
					</td>
				</tr>
			</thead>
			<tbody>
				<logic:present name="planRetailerForm" scope="request">
					<logic:iterate id="retailerList" name="planRetailerForm"
						property="retailerList">
						<tr pId="0">
							<td width="100">
							<input type="text"   value="<bean:write name='retailerList' property='partner' />">
								<bean:write name='retailerList' property='retailNo' />
							</td>
							<td width="100">
								<bean:write name='retailerList' property='retailName' />
							</td>
							<td width="100">
								<bean:write name='retailerList' property='retailType' />
							</td>
							<td width="100">
								<bean:write name='retailerList' property='city' />
							</td>
							<td width="100">
								<bean:write name='retailerList' property='loop' />
							</td>
							<td width="100">
								<bean:write name='retailerList' property='addr' />
							</td>
							<td width="9%">
									是否有新计划
							</td>
							<td width="100">
								<a
									href="redetailer/retailerListAction.do?method=toVisit&redetailerId=<bean:write name='retailerList' property='partner' />">拜访</a>
							</td>
							<td width="100">
								<a
									href="client/clientAction.do?method=listClient&redetailerId=<bean:write name='retailerList' property='partner' />">客户信息</a>
							</td>
							<td width="100">
								<a
									href="signContract/signContractApplyAction.do?method=list&redetailerId=<bean:write name='retailerList' property='partner' />">签约</a>
							</td>
							<td width="100">
								<a
									href="redetailer/retailerListAction.do?method=modify&partner=<bean:write name='retailerList' property='partner' />">编辑</a>
							</td>
						</tr>
					</logic:iterate>
				</logic:present>
			</tbody>
		</table>
	</div>
</body>
<script language="javascript">
//ejiaA1("名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");
ejiaA1("ejiaA1","#fff","#F5F5F5","#FFFFCC","#0066CC");
</script>
</html>
